﻿@model EzyGoEzySystem.Models.ProfileModel

@{
    ViewBag.Title = "Profile";
}

<h2>Update Profile</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-1.5.1.js")" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        if ($('#PaymentMethod').val() == "Post-pay") {
            $('#Card').show();
        }

        $('#PaymentMethod').change(function () {
            if ($('#PaymentMethod').val() == "Post-pay") {
                $('#Card').show();
            }
            else {
                $('#Card').hide();
            }
        });
    });
</script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Profile</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Email)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Email)
            @Html.ValidationMessageFor(model => model.Email)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PhoneNumber)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.PhoneNumber)
            @Html.ValidationMessageFor(model => model.PhoneNumber)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.MacAddress)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.MacAddress)
            @Html.ValidationMessageFor(model => model.MacAddress)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PaymentMethod)
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.PaymentMethod, Model.PaymentMethods)
        </div>

        <div id="Card" style="display:none;">
            <div class="editor-label">
                @Html.LabelFor(model => model.CreditCard)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.CreditCard)
            </div>
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
